<?php

//[类型定义]
//01. 创建一个human人类
class human{
public $name='名字';//公开的属性
protected $sex='女';//保护的性别
private $age='18';//私人的属性

}


//02. 创建一个家人扩展human人类
class family extends human{

function saying_sex(){
return $this->sex;
}

function saying_age(){
return $this->age;
}

}

//03. 用类定义对象
$human_a=new human();
$family_a=new family();

echo $human_a->name;
echo $family_a->saying_sex();
echo $family_a->saying_age();

?>